package com.deyuanyun.pic.pipe.controller.vo.merge;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.common.util.format.NumberFormat;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.pipe.controller.vo.DefaultCommand;
import com.deyuanyun.pic.pipe.domain.bo.GwwMergeBO;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

/**
 * 环焊缝信息：包括环焊缝 和 环焊缝无损检测
 */
public class GwwMergeVO extends DefaultCommand<GwwMergeBO> {

    // 主键
    private String id;
    // 管道名称
    private String pipeLineName;
    // 环焊缝焊接编号(自定义编号)
    private String gwwNumber;
    // 绝对距离(m)
    private String mileage;
    // wps编号(自定义编号)
    private String wpsNumber;
    // 施工日期
    private String constructionDate;
    // 记录人
    private String recorder;
    // 记录时间
    private String recordTime;
    // 链接计算结果表
    private String gisId;
    // 类型：0，环焊缝；1，环焊缝无损检测
    private String mergeType;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getGwwNumber() {
        return gwwNumber;
    }

    public void setGwwNumber(String gwwNumber) {
        this.gwwNumber = gwwNumber;
    }

    public String getMileage() {
        return mileage;
    }

    public void setMileage(String mileage) {
        this.mileage = mileage;
    }

    public String getWpsNumber() {
        return wpsNumber;
    }

    public void setWpsNumber(String wpsNumber) {
        this.wpsNumber = wpsNumber;
    }

    public String getConstructionDate() {
        return constructionDate;
    }

    public void setConstructionDate(String constructionDate) {
        this.constructionDate = constructionDate;
    }

    public String getRecorder() {
        return recorder;
    }

    public void setRecorder(String recorder) {
        this.recorder = recorder;
    }

    public String getRecordTime() {
        return recordTime;
    }

    public void setRecordTime(String recordTime) {
        this.recordTime = recordTime;
    }

    public String getGisId() {
        return gisId;
    }

    public void setGisId(String gisId) {
        this.gisId = gisId;
    }

    public String getMergeType() {
        return mergeType;
    }

    public void setMergeType(String mergeType) {
        this.mergeType = mergeType;
    }

    public void fromDomain(GwwMergeBO domain) {

        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }
        // id
        this.id = domain.getId();
        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 环焊缝焊接编号(自定义编号)
        this.gwwNumber = domain.getGwwNumber();
        // 绝对距离(m)
        this.mileage = NumberFormat.format(domain.getMileage());
        // wps编号(自定义编号)
        this.wpsNumber = domain.getWpsNumber();
        // 施工日期
        this.constructionDate = DateFormat.format(domain.getConstructionDate());
        // 记录人
        this.recorder = domain.getRecorder();
        // 记录时间
        this.recordTime = DateFormat.format(domain.getRecordTime());
        // gis地址
        this.gisId = domain.getGisId();
        // 类型：0，环焊缝；1，环焊缝无损检测
        this.mergeType = domain.getMergeType();
    }

    public Page<GwwMergeVO> fromDomainList(Page<GwwMergeBO> domainList) {
        Page<GwwMergeVO> list = new Page<GwwMergeVO>();
        for (GwwMergeBO gwwMergeBO : domainList) {
            GwwMergeVO gwwMergeVO = new GwwMergeVO();
            gwwMergeVO.fromDomain(gwwMergeBO);
            list.add(gwwMergeVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}